package com.qdlc.p2p.dal.mybatis.pager.support;

import com.qdlc.p2p.dal.mybatis.pager.core.PageParameter;
import com.qdlc.p2p.dal.mybatis.pager.core.PageSqlHanlder;

/**
 * MySql数据库的分页Sql处理
 * 
 * @author linya 2015-06-09 19:20:56
 */
public class MySqlPageSqlHanlder implements PageSqlHanlder {

	public String handle(String origSql, PageParameter pagerParameter) {
		StringBuilder pageSql = new StringBuilder(origSql.length() + 50);
		int beginrow = pagerParameter.getStartIndex();
		pageSql.append(origSql);
		pageSql.append(" limit " + beginrow + "," + pagerParameter.getPageSize());
		return pageSql.toString();
	}

}
